<!DOCTYPE html><html lang="zh-Hans"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta name="description" content="const常量与define宏定义，结构体的区别"><meta name="keywords" content="iOS"><meta name="author" content="kyren"><meta name="copyright" content="kyren"><title>const常量与define宏定义，结构体的区别 | Kyren's Blog</title><link rel="shortcut icon" href="/melody-favicon.ico"><link rel="stylesheet" href="/css/index.css?version=1.9.0"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css?version=1.9.0"><meta name="format-detection" content="telephone=no"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="dns-prefetch" href="https://hm.baidu.com"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?cf87fcdbd9ab7cf93d894f7c219ae78f";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();</script><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><script src="https://v1.hitokoto.cn/?encode=js&amp;charset=utf-8&amp;select=.footer_custom_text" defer></script><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容:${query}"}},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  hexoVersion: '6.2.0'
} </script><meta name="generator" content="Hexo 6.2.0"></head><body><i class="fa fa-arrow-right" id="toggle-sidebar" aria-hidden="true"></i><div id="sidebar" data-display="true"><div class="toggle-sidebar-info text-center"><span data-toggle="切换文章详情">切换站点概览</span><hr></div><div class="sidebar-toc"><div class="sidebar-toc__title">目录</div><div class="sidebar-toc__progress"><span class="progress-notice">你已经读了</span><span class="progress-num">0</span><span class="progress-percentage">%</span><div class="sidebar-toc__progress-bar"></div></div><div class="sidebar-toc__content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#define%E5%92%8Cconst%E5%8C%BA%E5%88%AB"><span class="toc-number">1.</span> <span class="toc-text">#define和const区别</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#static%E7%AE%80%E4%BB%8B"><span class="toc-number">2.</span> <span class="toc-text">static简介</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#const%E7%AE%80%E4%BB%8B"><span class="toc-number">3.</span> <span class="toc-text">const简介</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%85%B6%E5%AE%83%E5%85%A8%E5%B1%80%E5%B8%B8%E9%87%8F%E7%9A%84%E4%B8%80%E4%BA%9B%E5%86%99%E6%B3%95"><span class="toc-number">3.1.</span> <span class="toc-text">其它全局常量的一些写法</span></a></li></ol></li></ol></div></div><div class="author-info hide"><div class="author-info__avatar text-center"><img src="https://avatars.githubusercontent.com/u/5827823?v=4"></div><div class="author-info__name text-center">kyren</div><div class="author-info__description text-center">huluo的技术博客</div><div class="follow-button"><a target="_blank" rel="noopener" href="https://github.com/huluo666">Follow Me</a></div><hr><div class="author-info-articles"><a class="author-info-articles__archives article-meta" href="/archives"><span class="pull-left">文章</span><span class="pull-right">239</span></a><a class="author-info-articles__tags article-meta" href="/tags"><span class="pull-left">标签</span><span class="pull-right">41</span></a><a class="author-info-articles__categories article-meta" href="/categories"><span class="pull-left">分类</span><span class="pull-right">29</span></a></div><hr><div class="author-info-links"><div class="author-info-links__title text-center">Links</div><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:9090/">Jira</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:8090/">Confluence</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://bloc.leniugame.com/">Leniu</a></div></div></div><div id="content-outer"><div class="no-bg" id="top-container"><div id="page-header"><span class="pull-left"> <a id="site-name" href="/">Kyren's Blog</a></span><i class="fa fa-bars toggle-menu pull-right" aria-hidden="true"></i><span class="pull-right menus">   <a class="site-page" href="/">主页</a><a class="site-page" href="/essay">随笔</a><a class="site-page" href="/archives">归档</a><a class="site-page" href="/tags">标签</a><a class="site-page" href="/categories">分类</a><a class="site-page" href="/about">关于</a></span><span class="pull-right"><a class="site-page social-icon search"><i class="fa fa-search"></i><span> 搜索</span></a></span></div><div id="post-info"><div id="post-title">const常量与define宏定义，结构体的区别</div><div id="post-meta"><time class="post-meta__date"><i class="fa fa-calendar" aria-hidden="true"></i> 2017-04-21</time><span class="post-meta__separator">|</span><i class="fa fa-inbox post-meta__icon" aria-hidden="true"></i><a class="post-meta__categories" href="/categories/iOS/">iOS</a></div></div></div><div class="layout" id="content-inner"><article id="post"><div class="article-container" id="post-content"><h4 id="define和const区别"><a href="#define和const区别" class="headerlink" title="#define和const区别"></a>#define和const区别</h4><p><strong>(1) 编译器处理方式不同</strong></p>
<ul>
<li><code>编译时刻</code>:define宏是预编译（编译之前处理），const是编译运行阶段。</li>
</ul>
<p><strong>(2) 类型和编译安全检查不同</strong></p>
<ul>
<li>define宏没有类型，不做任何类型检查，仅仅是替换展开，不会报编译错误。</li>
<li>const常量有具体的类型，在编译阶段会执行类型检查，会报编译错误。</li>
<li>有些集成化的调试工具可以对const常量进行调试，但是不能对宏常量进行调试。</li>
</ul>
<p><strong>(3) 存储方式不同</strong></p>
<ul>
<li>define宏仅仅是展开，有多少地方使用，就展开多少次，不会分配内存。（宏定义不分配内存，<strong>变量定义</strong>分配内存。）</li>
<li>const常量会在内存中分配(可以是堆中也可以是栈中)。</li>
</ul>
<p><strong>(4)const  可以节省空间，避免不必要的内存分配。</strong></p>
<p> 例如：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">define</span> PI 3.14159 <span class="comment">//常量宏</span></span></span><br><span class="line"><span class="keyword">const</span> <span class="type">double</span> Pi=<span class="number">3.14159</span>; <span class="comment">//此时并未将Pi放入ROM中 ......</span></span><br><span class="line"><span class="type">double</span> i=Pi; <span class="comment">//此时为Pi分配内存，以后不再分配！</span></span><br><span class="line"><span class="type">double</span> I=PI; <span class="comment">//编译期间进行宏替换，分配内存</span></span><br><span class="line"><span class="type">double</span> j=Pi; <span class="comment">//没有内存分配</span></span><br><span class="line"><span class="type">double</span> J=PI; <span class="comment">//再进行宏替换，又一次分配内存！</span></span><br></pre></td></tr></table></figure>
<p>宏是直接替换的,它会产生许多个临时的存储空间来存储需要替换的部分,这样会浪费内存,没有必要。 const定义常量从汇编的角度来看，只是给出了对应的内存地址，而不是象#define一样给出的是立即数，所以，const定义的常量在程序运行过程中只有一份拷贝（因为是全局的只读变量，存在静态区），而 #define定义的常量在内存中有若干个拷贝。</p>
<p><strong>(5) 提高了效率。</strong></p>
<p> 编译器通常不为普通const常量分配存储空间，而是将它们保存在符号表中，这使得它成为一个编译期间的常量，没有了存储与读内存的操作，使得它的效率也很高。使用大量#define宏，容易造成编译时间久，每次都需要重新替换。</p>
<p><strong>(6) 宏替换只作替换，不做计算，不做表达式求解;</strong></p>
<p>宏预编译时就替换了，程序运行时，并不分配内存。</p>
<h4 id="static简介"><a href="#static简介" class="headerlink" title="static简介"></a>static简介</h4><ul>
<li>修饰局部变量：<br>1.延长局部变量的生命周期,程序结束才会销毁。<br>2.局部变量只会生成一份内存,只会初始化一次。</li>
<li>修饰全局变量<br>1.只能在本文件中访问,修改全局变量的作用域,生命周期不会改。</li>
</ul>
<h4 id="const简介"><a href="#const简介" class="headerlink" title="const简介"></a>const简介</h4><p>之前常用的字符串常量，一般是抽成宏，但是苹果不推荐我们抽成宏，推荐我们使用const常量。</p>
<p>const在C语言中算是一个比较新的描述符，我们称之为常量修饰符，意即其所修饰<br>的对象为常量(immutable)。</p>
<p>const只修饰它右边的内容，被const修饰的内容都是常量、都是不能再修改的</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// （基本数据变量p，指针变量*p）</span></span><br><span class="line"><span class="comment">// const修饰指针变量访问的内存空间，修饰的是右边*p1，</span></span><br><span class="line"><span class="type">int</span>  *<span class="type">const</span> p1; <span class="comment">// p1:常量 *p1:变量--(*常量=指针变量)</span></span><br><span class="line"><span class="type">int</span>  <span class="type">const</span> *p2; <span class="comment">// p2:变量 *p2:常量</span></span><br><span class="line"><span class="type">const</span> <span class="type">int</span> *p3;  <span class="comment">// p3:变量 *p3:常量</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 第一个const修饰*p4 第二个const修饰 p4</span></span><br><span class="line"><span class="comment">// 两种方式一样，也即被const修饰的内容都是常量</span></span><br><span class="line"><span class="type">const</span> <span class="type">int</span> * <span class="type">const</span> p4;  <span class="comment">//  p4：常量 *p4：常量</span></span><br><span class="line"><span class="type">int</span> <span class="type">const</span> * <span class="type">const</span> p5;  <span class="comment">//  p5：常量 *p4：常量</span></span><br></pre></td></tr></table></figure>

<ul>
<li>注：判断p和p是只读还是变量 关键是看const在谁前面。<ul>
<li>如果只在p前面，那么p只读 *p还是变量；</li>
<li>如果在*p前面，p是变量   *p是只读。</li>
</ul>
</li>
</ul>
<p><code>extern</code>与<code>const</code>联合使用</p>
<p>开发中使用场景:在多个文件中经常使用的同一个字符串常量，可以使用extern与const组合。</p>
<p>原因:</p>
<ul>
<li>static与const组合：在每个文件都需要定义一份静态全局变量。</li>
<li>extern与const组合:只需要定义一份全局变量，多个文件共享。</li>
</ul>
<p>例如：</p>
<p>AppConst.h</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">static</span> <span class="built_in">NSString</span> *<span class="keyword">const</span> kStr1  = <span class="string">@&quot;kimi&quot;</span>;<span class="comment">//此处定义的kStr1不能改变，否则会发生错误</span></span><br><span class="line"><span class="keyword">static</span> <span class="built_in">NSString</span>  <span class="keyword">const</span> *kStr2 = <span class="string">@&quot;kimi&quot;</span>;<span class="comment">//跟上面的定义写法不同，但是结果一样</span></span><br><span class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="built_in">NSString</span>  *kStr3 = <span class="string">@&quot;kimi&quot;</span>;<span class="comment">//此处定义的kStr可修改其值，但是修改过后他们的内存地址一样。</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">extern</span> <span class="built_in">NSString</span> *<span class="keyword">const</span> kStr4;</span><br><span class="line"><span class="keyword">extern</span> <span class="built_in">NSString</span> *<span class="keyword">const</span> kStr5;</span><br></pre></td></tr></table></figure>

<p>AppConst.m</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">NSString</span> *<span class="keyword">const</span> kStr4 = <span class="string">@&quot;kimi&quot;</span>;</span><br><span class="line"><span class="built_in">NSString</span> *<span class="keyword">const</span> kStr5 = <span class="string">@&quot;kimi&quot;</span>;</span><br></pre></td></tr></table></figure>



<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">2017-04-21 14:47:02.077  kStr1内存地址： 0x109ddd0e0=FirstViewController</span><br><span class="line">2017-04-21 14:47:02.078  kStr2内存地址： 0x109dde408=FirstViewController</span><br><span class="line">2017-04-21 14:47:02.079  kStr3内存地址： 0x109dde410=FirstViewController</span><br><span class="line">2017-04-21 14:47:02.079  kStr4内存地址： 0x109ddd0d0=FirstViewController</span><br><span class="line">2017-04-21 14:47:02.080  kStr5内存地址： 0x109ddd0d8=FirstViewController</span><br><span class="line"></span><br><span class="line">2017-04-21 14:47:27.747  kStr1内存地址： 0x109ddd080=SecViewController</span><br><span class="line">2017-04-21 14:47:27.748  kStr2内存地址： 0x109dde320=SecViewController</span><br><span class="line">2017-04-21 14:47:27.748  kStr3内存地址： 0x109dde328=SecViewController</span><br><span class="line">2017-04-21 14:47:27.748  kStr4内存地址： 0x109ddd0d0=SecViewController</span><br><span class="line">2017-04-21 14:47:27.749  kStr5内存地址： 0x109ddd0d8=SecViewController</span><br><span class="line"></span><br><span class="line">2017-04-21 14:47:51.019  kStr1内存地址： 0x109ddd088=TestViewController</span><br><span class="line">2017-04-21 14:47:51.019  kStr2内存地址： 0x109dde3f0=TestViewController</span><br><span class="line">2017-04-21 14:47:51.020  kStr3内存地址： 0x109dde3f8=TestViewController</span><br><span class="line">2017-04-21 14:47:51.020  kStr4内存地址： 0x109ddd0d0=TestViewController</span><br><span class="line">2017-04-21 14:47:51.020  kStr5内存地址： 0x109ddd0d8=TestViewController</span><br></pre></td></tr></table></figure>

<p>结论：使用<code>static NSString *const xxx  = @&quot;xxx&quot;</code>; 申明的静态全局常量，经过测试页面消失进入，相同Controller打印的内存地址相同，在不同Controller中内存地址不同，表明如果在不同文件中使用会占据多个内存空间，而使用 <code>extern NSString *const xxxx</code> 申明的全局静态变量，在不同文件中的内存地址都是相同的，表面只开辟一个内存空间。</p>
<p>所以，全局常量正规写法:开发中便于管理所有的全局变量，通常创建GlobeConst文件，里面专门定义全局变量，统一管理。</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//GlobeConst.h</span></span><br><span class="line"><span class="keyword">extern</span> <span class="built_in">NSString</span> * <span class="keyword">const</span> KNameKey = <span class="string">@&quot;kimi&quot;</span>;</span><br><span class="line">FOUNDATION_EXPORT <span class="built_in">NSString</span> *<span class="keyword">const</span> MyFirstConstant;</span><br><span class="line">FOUNDATION_EXPORT <span class="built_in">NSString</span> *<span class="keyword">const</span> MySecondConstant;</span><br><span class="line"><span class="comment">//etc.</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//GlobeConst.m</span></span><br><span class="line"><span class="built_in">NSString</span> * <span class="keyword">const</span>    KNameKey = <span class="string">@&quot;kimi&quot;</span>;</span><br><span class="line"><span class="built_in">NSString</span> *<span class="keyword">const</span> MyFirstConstant = <span class="string">@&quot;FirstConstant&quot;</span>;</span><br><span class="line"><span class="built_in">NSString</span> *<span class="keyword">const</span> MySecondConstant = <span class="string">@&quot;SecondConstant&quot;</span>;</span><br></pre></td></tr></table></figure>

<p>当然由于开发中常用数据类型所占字节很小，所以使用<code>static NSString *const xxx  = @&quot;xxx&quot;</code>来申明全局常量问题也不大，可以不在GlobeConst.m中添加代码，相对方便。</p>
<p>使用字符串常量代替 <code>#define</code>宏定义会常数是可以使用指针比较相等性测试 (<code>stringInstance == MyFirstConstant</code>) 这比字符串比较快得多 (<code>[stringInstance isEqualToString:MyFirstConstant]</code>)</p>
<p>传送门：<a target="_blank" rel="noopener" href="http://huluo666.cn/2016/05/23/%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B8%B8%E9%87%8F/">常用数据类型对应字节数</a></p>
<h5 id="其它全局常量的一些写法"><a href="#其它全局常量的一些写法" class="headerlink" title="其它全局常量的一些写法"></a>其它全局常量的一些写法</h5><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// in the header</span></span><br><span class="line"><span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">struct</span> MANotifyingArrayNotificationsStruct</span><br><span class="line">&#123;</span><br><span class="line">    <span class="built_in">NSString</span> *didAddObject;</span><br><span class="line">    <span class="built_in">NSString</span> *didChangeObject;</span><br><span class="line">    <span class="built_in">NSString</span> *didRemoveObject;</span><br><span class="line">&#125; MANotifyingArrayNotifications;</span><br><span class="line"></span><br><span class="line"><span class="comment">// in the implementation</span></span><br><span class="line"><span class="keyword">const</span> <span class="keyword">struct</span> MANotifyingArrayNotificationsStruct MANotifyingArrayNotifications = &#123;</span><br><span class="line">    .didAddObject = <span class="string">@&quot;didAddObject&quot;</span>,</span><br><span class="line">    .didChangeObject = <span class="string">@&quot;didChangeObject&quot;</span>,</span><br><span class="line">    .didRemoveObject = <span class="string">@&quot;didRemoveObject&quot;</span></span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line"><span class="comment">//访问</span></span><br><span class="line">   <span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>,MANotifyingArrayNotifications.didAddObject);</span><br></pre></td></tr></table></figure>



<p>定义UIKit常量注意将.m文件改成.mm</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">+ (<span class="built_in">UIColor</span> *)paleYellowColor</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">static</span> <span class="built_in">UIColor</span>* paleYellow = <span class="literal">nil</span>;</span><br><span class="line">    <span class="keyword">if</span> (paleYellow == <span class="literal">nil</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        paleYellow = [<span class="built_in">UIColor</span> colorWithHueDegrees:<span class="number">60</span> saturation:<span class="number">0.2</span> brightness:<span class="number">1.0</span>];</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> paleYellow;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">.h文件</span><br><span class="line"><span class="keyword">extern</span> <span class="built_in">UIColor</span> *  <span class="keyword">const</span> COLOR_LIGHT_BLUE;</span><br><span class="line"></span><br><span class="line">.mm文件</span><br><span class="line"><span class="built_in">UIColor</span>* <span class="keyword">const</span> COLOR_LIGHT_BLUE = [[<span class="built_in">UIColor</span> alloc] initWithRed:<span class="number">21.0</span>f/<span class="number">255</span> green:<span class="number">180.0</span>f/<span class="number">255</span>  blue:<span class="number">1</span> alpha:<span class="number">1</span>];</span><br></pre></td></tr></table></figure>



<p>使用单例保存全局变量</p>
<p><a target="_blank" rel="noopener" href="http://zhangbuhuai.com/initialize-and-load-in-objectivec/">+initialize和+load</a></p>
</div></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">kyren</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://huluo666.gitee.io/2017/04/21/const常量与define宏定义，结构体的区别/">http://huluo666.gitee.io/2017/04/21/const常量与define宏定义，结构体的区别/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://huluo666.gitee.io">Kyren's Blog</a>！</span></div></div><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/iOS/">iOS</a></div><nav id="pagination"><div class="prev-post pull-left"><a href="/2017/04/24/iOS%20IPA%E9%87%8D%E7%AD%BE%E5%90%8D/"><i class="fa fa-chevron-left">  </i><span>iOSipa重签名</span></a></div><div class="next-post pull-right"><a href="/2017/04/20/iOS%E5%B8%B8%E6%95%B0%E7%9A%84%E5%AE%9A%E4%B9%89/"><span>iOS常数的定义</span><i class="fa fa-chevron-right"></i></a></div></nav></div></div><footer><div class="layout" id="footer"><div class="copyright">&copy;2022 By kyren</div><div class="framework-info"><span>驱动 - </span><a target="_blank" rel="noopener" href="http://hexo.io"><span>Hexo</span></a><span class="footer-separator">|</span><span>主题 - </span><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/hexo-theme-melody"><span>Melody</span></a></div><div class="footer_custom_text">hitokoto</div><div class="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_page_pv"><i class="fa fa-file"></i><span id="busuanzi_value_page_pv"></span><span></span></span></div></div></footer><i class="fa fa-arrow-up" id="go-up" aria-hidden="true"></i><script src="https://cdn.jsdelivr.net/npm/animejs@latest/lib/anime.min.js"></script><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@latest/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-ui-pack@latest/velocity.ui.min.js"></script><script src="/js/utils.js?version=1.9.0"></script><script src="/js/fancybox.js?version=1.9.0"></script><script src="/js/sidebar.js?version=1.9.0"></script><script src="/js/copy.js?version=1.9.0"></script><script src="/js/fireworks.js?version=1.9.0"></script><script src="/js/transition.js?version=1.9.0"></script><script src="/js/scroll.js?version=1.9.0"></script><script src="/js/head.js?version=1.9.0"></script><script src="/js/search/local-search.js"></script><script>if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
  $('#nav').addClass('is-mobile')
  $('footer').addClass('is-mobile')
  $('#top-container').addClass('is-mobile')
}</script><div class="search-dialog" id="local-search"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章"></div></div></div><hr><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>由</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a>
 <span>提供支持</span></div></div></div><span class="search-close-button"><i class="fa fa-times"></i></span></div><div class="search-mask"></div></body></html>